package com.example.wiki1.controller;
import com.example.wiki1.req.EbookReq;
import com.example.wiki1.resp.CommonResp;
import com.example.wiki1.resp.EbookResp;
import com.example.wiki1.resp.PageResp;
import com.example.wiki1.service.EbookService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@RequestMapping("/ebook")
public class EbookController {

    @Resource
    private EbookService ebookService;
    @GetMapping("/list")
    public CommonResp list(EbookReq req){
        //把查询结果放到列表中
        CommonResp<PageResp<EbookResp>> resp =new CommonResp<>();
        //创建一个CommResp类型对象resp
        PageResp<EbookResp> list =ebookService.list(req);
        //将resp对象中的内容设置为查询结果列表list
        resp.setContent(list);
        //返回resp对象
        return resp;

    }
}
